Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

первое домашнее задание #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RuslanTroshkov
Copy link
Owner

No description provided.

// Написать тест, который проверяет, что коэффициент a не может быть равен 0. В этом случае solve выбрасывает исключение.
@Test
fun test4() {
val a = 0.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше не 0 использовать, а маленькое число 1e-10,
чтобы отловить случай проверки if(a==0.0)


class HomeWorkUnitTest {
private val quadraticEquation by lazy {
QuadraticEquation()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не нашел реализацию этого класса

discriminant = quadraticEquation.discriminant(a, b, c)
assertTrue(discriminant < 5)
assertFalse(discriminant < 4)
assertTrue(discriminant == 4.0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

числа с плавающей точкой так сравнивать нельзя
a == b <=> |a-b| < eps, где eps - это маленькое число

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants